import instance from "../utils/axios_config.js";

export {getGoodsPage, getCategory, queryGoods, queryGoodsById, delGoods, editGoods, editStatus}
// 查询列表接口
const getGoodsPage = (params) => {
    return instance({
        url: '/goods/list',
        method: 'get',
        params
    })
}
const getCategory = () => {
    return instance({
        url: '/category/phone',
        method: 'get',
    })
}
// 条件查询用户列表
const queryGoods = (params) => {
    return instance({
        url: `/goods/find`,
        method: 'post',
        data: {...params}
    })
}

// 编辑页面反查详情接口
const queryGoodsById = (id) => {
    return instance({
        url: `/goods/` + id,
        method: 'get',
    })
}
const editStatus = (id, status) => {
    return instance({
        url: `/goods/editStatus`,
        method: 'put',
        params: {id, status}
    })
}

// 下架二手手机
const delGoods = (id) => {
    return instance({
        url: '/goods/' + id,
        method: 'delete'
    })
}


// 修改接口
const editGoods = (params) => {
    return instance({
        url: '/goods',
        method: 'put',
        data: {...params}
    })
}
